/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ifconnect.model.dao;

import ifconnect.model.entity.Campus;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Genemes
 */
public class CampusDao extends DaoGenerico implements Serializable {

    public CampusDao() {
        super();
    }

    public boolean cadastroCampus(Campus campus) {
        try {
            this.salvar(campus);
            return true;
        } catch (Exception ex) {
            ex.printStackTrace();
            this.getEntityManager().getTransaction().rollback();
            return false;
        }
    }

    public boolean excluirCampus(Long id) {
        Campus c = null;
        try {
            c = this.buscar(Campus.class, id);
            this.remover(c);
            return true;
        } catch (Exception ex) {
            ex.printStackTrace();
            this.getEntityManager().getTransaction().rollback();
            return false;
        }
    }
    
    public List<Campus> listar(){
        List<Campus> listaCampus = new ArrayList<Campus>();
        listaCampus = this.listarTodos(Campus.class);
        return listaCampus;
    }
}
